package com.hzgj.demo.c;

import com.hzgj.demo.d.DRet;
import com.hzgj.demo.d.DService;
import com.hzgj.demo.e.ERet;
import com.hzgj.demo.e.EService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created by Administrator on 2016/9/22.
 */
@Component
public class CServiceImpl implements CService {

    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private EService eService;
    @Autowired
    private DService dService;

    @Override
    public CRet getServiceFromED() {
        ERet eRet = eService.getServiceFromG();
        for (String item : eRet.getData()) {
            logger.info("get data from e " + item);
        }
        DRet dRet = dService.getServiceFromD();
        logger.info("get data from d in " + dRet.getDate());
        return new CRet(eRet.getData(), "c", new Date());
    }
}
